﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PresentationExamples
{
    class PresentationExamples
    {
        static void Main(string[] args)
        {
            //Cat myCat = new Cat("Gabi", "Misho");
            //myCat.SayMiau();
            //Cat myOtherCat = new Cat();
            //myOtherCat.Name = "Zhana";
            //myOtherCat.SayMiau();
            //Dog myDog = new Dog();
            //myDog.Name = "Hera";
            //myDog.Bark();
            //Dog sharo = new Dog();
            //sharo.Name = "Sharko";
            //Dog rex = new Dog();
            //rex.Name = "Rexy";
            //Dog someDog = new Dog();
            //Dog[] dogArr = new Dog[3];
            //dogArr[0] = sharo;
            //dogArr[1] = rex;
            //dogArr[2] = someDog;
            //foreach (var item in dogArr)
            //{
            //    item.Bark();
            //}
            //Dog anotherDog = new Dog("Ara");
            //anotherDog.Breed = "Labrador";

            //Example from presentation:
            //Console.Write("Enter first dog's name:");
            //string dogName = Console.ReadLine();
            //Console.Write("Enter first dog's breed:");
            //string dogBreed = Console.ReadLine();
            //Dog firstDog = new Dog(dogName, dogBreed);

            //Dog secondDog = new Dog();
            //Console.Write("Enter second dog's name:");
            //secondDog.Name = Console.ReadLine();
            //Console.Write("Enter second dog's breed:");
            //secondDog.Breed = Console.ReadLine();

            //Dog thirdDog = new Dog();

            //Dog[] dogs = new Dog[]
            //{
            //    firstDog, secondDog, thirdDog
            //};
            //foreach (Dog dog in dogs)
            //{
            //    dog.Bark();
            //}

            ////Point distance.         // Recursion, why?
            //Point pt = new Point();
            //pt.XCoord = 5;
            //pt.YCoord = 5;
            //Point p = new Point();
            //p.XCoord = 15;
            //p.YCoord = 15;
            //double distance = p.CalcDistance(pt);
            //Console.WriteLine(distance);

            Console.WriteLine(Constants.PI);
            Constants c = new Constants(5);
            Console.WriteLine(c.Size);
            //c.Size = 10;//Compialation error: read only field.
            //Console.WriteLine(Constants.Size);// Compile error.
        }
    }
    public class Cat
    {
        private string name;
        private string owner;

        public Cat() 
        {
        }

        public Cat(string name, string owner)
        {
            this.name = name;
            this.owner = owner;
        }
        public string Name
        {
            get {return this.name; }
            set { this.name = value; }
        }
        public string Owner
        {
            get { return this.owner; }
            set { this.owner = value;}
        }
        public void SayMiau()
        {
            Console.WriteLine("Gruh!");
        }
    }
    public class Dog
    {
        private string name;
        private string breed;

        public Dog()
        {
            this.name = "Podrazbirko";
            this.breed = "Podrazbirasht";
        }

        public Dog(string name)
        {
            this.name = name;
        }

        public Dog(string name, string breed)
        {
            this.name = name;
            this.breed = breed;
        }
        public string Name
        {
            get { return this.name; }
            set { this.name = value; }
        }
        public string Breed
        {
            get { return this.breed; }
            set { this.breed = value; }
        }

        public void Bark()
        {
            Console.WriteLine("{0} said bau!", this.name ?? "[unnamed dog]");
        }
    }
    public class Point
    {
        private int xCoord;
        private int yCoord;

        //Simple parameterless constructor
        public Point()  
        {
        }

        public Point(int xCoord, int yCoord)
        { 
            this.xCoord = xCoord;
            this.yCoord = yCoord;

        }

        public int XCoord
        {
            get { return this.xCoord; }
            set { this.xCoord = value; }
        }
        public int YCoord
        {
            get { return this.YCoord; }
            set { this.YCoord = value; }
        }

        public double CalcDistance(Point p)
        {
            return Math.Sqrt((p.xCoord - this.xCoord) * (p.xCoord - this.xCoord)
                + (p.yCoord - this.yCoord) * (p.yCoord - this.yCoord));
        }
    }
    public class Person
    {
        private string name;
        private int age;

        //Parameterless constructor
        public Person()
        {
            this.name = null;
            this.age = 0;
        }

        //Constructor with parameters
        public Person(string name, int age)
        {
            this.name = name;
            this.age = age;
        }

        public string Name
        {
            get { return this.name; }
            set 
            {
                if (String.IsNullOrEmpty(value))
                {
                    throw new ArgumentException("Invalid name!");
                }
                this.name = value; 
            }
        }
        public int Age
        {
            get { return this.age; }
            set { this.age = value; }
        }
    }
    public class AlarmClock
    {
        private int hours = 9;
        private int minutes = 0;

        //Parameterless constructor (intentionally left empty)
        public AlarmClock()
        { }
         
        //Constructor with parameteres
        public AlarmClock(int hours, int minutes)
        {
            this.hours = hours;     //Invoked after the inline initialization.
            this.minutes = minutes;
        }

        public int Hours
        {
            get { return this.hours; }
            set { this.hours = value; }
        }
        public int Minutes
        {
            get { return this.minutes; }
            set { this.minutes = value; }
        }
    }
    public enum DayOfWeek
    { 
        Mon, Tue, Wed, Thu, Fri, Sat, Sun
    }
    //class EnumExample
    //{
    //    static void Main()
    //    {
    //        DayOfWeek day = DayOfWeek.Wed;
    //        Console.WriteLine(day);
    //    }
    //}
    public enum CoffeeSize
    { 
        Small = 100, Normal = 150, Double = 200
    }
    public class Coffee
    {
        public CoffeeSize size;
        public Coffee(CoffeeSize size)
        {
            this.size = size;
        }
        public CoffeeSize Size
        {
            get { return size; }
        }
    }
    //public class CoffeeMachine
    //{
    //    static void Main()
    //    {
    //        Coffee normalCof = new Coffee(CoffeeSize.Normal);
    //        Coffee doubleCof = new Coffee(CoffeeSize.Double);
    //        Console.WriteLine("The {0} coffee is {1}ml.", normalCof.Size, (int)normalCof.Size);
    //        Console.WriteLine("The {0} coffee is {1}ml.", doubleCof.Size, (int)doubleCof.Size);
    //    }
    //}
    public class Constants
    {
        public const double PI = 3.1415926535897932385;
        public readonly double Size;
        public Constants(double size)
        {
            this.Size = size; // Cannot be further modified.
        }
    }

}
